package com.lyt.controller;

import com.lyt.bean.LinkAnswer;
import com.lyt.service.TestAnswerService;
import com.lyt.service.TestStatuService;
import com.lyt.vo.LinkAnswerVo;
import com.lyt.vo.RetAnswerVo;
import com.lyt.vo.TestAnswerVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author:张勇
 * @Date：2023/5/16 19:44
 * @Info:
 */
@RestController
@CrossOrigin
public class TestAnswerController {
    @Autowired
    public TestAnswerService testAnswerservice;

    @RequestMapping("/testAnswer/add")
    public int addAnswer(@RequestBody TestAnswerVo testAnswerVo)throws Exception{

        System.out.println("我提交答案了"+testAnswerVo.toString());
        int xx = testAnswerservice.addTestStatus(testAnswerVo);

        return xx;
    }

    @RequestMapping("/testAnswer/selAnswer")
    public List<RetAnswerVo> selAnswer(@Param("paper_id")Integer paper_id, @Param("stu_id") Integer stu_id)throws Exception{
        List<RetAnswerVo> list = testAnswerservice.selAnswerById(stu_id,paper_id);
        System.out.println(list);
        return list;
    }

}

